//
//  StyleTableViewCell.m
//  MMLOOK
//
//  Created by dllo on 15/8/24.
//  Copyright (c) 2015年 武俊娥. All rights reserved.
//

#import "StyleTableViewCell.h"
#import "CircleView.h"

@implementation StyleTableViewCell

- (void)dealloc
{
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
    }
    return self;
}

//创建四个按钮

 - (void)creatButton
{
    CGFloat width = [UIScreen mainScreen].bounds.size.width / 4.0f;
    
        NSArray *array = @[@"小配饰", @"美美穿", @"选护肤", @"享美食"];
        
        for (int i = 0; i < 4; i++) {
            
            CircleView *circle = [[[CircleView alloc] initWithFrame:CGRectMake(i * width, 0, width, 80 * OffHeight)] autorelease];
            
            circle.tag = i + 1;
            
            circle.target = self;
            
            circle.Action = @selector(ClickAction:);
            
            NSString *name = [NSString stringWithFormat:@"%d.png", i + 5];
            
            [circle setImage:name text:array[i]];
            
            [self.contentView addSubview:circle];
        }
}

- (void)ClickAction: (CircleView *)circle
{
    [self.delegate clickStyleWith:circle.tag];
}

- (void)setFlag:(BOOL)flag
{
    if (_flag != flag) {
        
        _flag = flag;
    }
    
    if (_flag == YES) {
        
        [self creatButton];
    }
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
